<form class="form-horizontal" id="merchDetailForm">
    <input class="hidden" name="agentId" th:value="${merch.id}">
    <input class="hidden" name="mch_id" th:value="${merch.merchMerchantNo}">

    <div class="box-body">
        <div class="form-group required">
            <label for="merchName" class="col-sm-3 control-label">商户名称 :</label>
            <div class="col-sm-8">
                <input type="text" th:value="${merch.merchName}" class="form-control" name="merchName" id="merchName"  require="必填项"  placeholder="" />
            </div>
        </div>
        <div class="form-group required">
            <label  class="col-sm-3 control-label">类型名称 :</label>
            <div class="col-sm-8">
                <input type="text" class="form-control" name="tradeType" require="必填项"  placeholder="请输入类型名称" />
            </div>
        </div>
        <div class="form-group required">
            <label class="col-sm-3 control-label">设置费率 :</label>
            <div class="col-sm-8">
                <input type="text" class="form-control" name="rate" require="必填项" number="格式不正确，只能输入数字"  placeholder="请输入费率值" />
            </div>
        </div>

        <div class="form-group">
            <label  class="col-sm-3 control-label">上游商户 :</label>
            <div class="col-sm-8">
                <select name="name" class="form-control" require="必选项">
                    <option value="">--请选择--</option>
                    <option th:each="c:${channels}" th:value="${c.merchantNo}" th:text="${c.channelName}"></option>
                </select>
            </div>
        </div>


        <div>
            交易类型请输入： 比如设置商户费率千2 请输入：0.002<br>
            代付类型请输入： 比如设置代付每笔2元 请输入：2<br>
            设置相同的值将会覆盖之前设置的值,设置成功将会立马生效<br>
        </div>



    </div>
    <!-- /.box-body -->
    <div class="box-footer">
        <div class="pull-right">
            <button type="button" id="saveDetailMerch" class="btn btn-info">确定</button>
            <button type="button" data-dismiss="modal" class="btn btn-default">取消</button>
        </div>
    </div>
    <!-- /.box-footer -->
</form>

<script>
    $(function () {
        $("#saveDetailMerch").on('click', function () {
            if(doValidForm(merchDetailForm)){
                Core.mask("#saveDetailMerch")
                Core.postAjax(ctxPath + "/merch/merchrate",$("#merchDetailForm").serialize(),function (data) {
                    Core.unmask("#saveDetailMerch");
                    if(data.code==200){
                        $("#merchRateModal").modal("hide");
                        Core.refreshJqTable("#table_list",true);
                    }
                    layer.msg(data.msg);
                })
            }
        })
    });
</script>